package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.wx.topic.vo.AllTopicVo;
import com.cskaoyan.bean.wx.topic.vo.TopicDetailVo;
import com.cskaoyan.bean.wx.topic.vo.TopicsVo;
import com.cskaoyan.service.wx.WxTopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Name : WxTopicController.java
 * @Time : 2021/8/17 08:43
 * @Author : creamycandy
 * @Software : IntelliJ IDEA
 */

@RestController
@RequestMapping("wx/topic")
public class WxTopicController {

    @Autowired
    WxTopicService wxTopicService;

    @RequestMapping("list")
    public BaseRespVo getList(Integer page, Integer size) {
        TopicsVo topicList = wxTopicService.getTopicList(page, size);
        return BaseRespVo.ok(topicList);
    }

    @RequestMapping("detail")
    public BaseRespVo getDetail(Integer id){
        TopicDetailVo topicDetail = wxTopicService.getTopicDetail(id);
        return BaseRespVo.ok(topicDetail);
    }

    @RequestMapping("related")
    public BaseRespVo getRelated(Integer id){
        List<AllTopicVo> topicRelated = wxTopicService.getTopicRelated(id);
        return BaseRespVo.ok(topicRelated);
    }
}
